(function(b, c) {
	var j = String.fromCharCode,
		h = true,
		d = false;

	function e(k, l) {
		return l ? j(k & 255) + e(k >> 8, l - 1) : ""
	}

	function g(k, l) {
		return l ? g(k >> 8, l - 1) + j(255 - k & 255) : ""
	}

	function i(k, l, m) {
		return m ? g(k, l) : e(k, l)
	}

	function a(r, q) {
		var k = r.length,
			p = k - 1,
			s = 0,
			o = c.pow,
			m;
		if (q) {
			for (m = 0; m < k; m++) {
				s += (255 - r.charCodeAt(m)) * o(256, p - m)
			}
		} else {
			for (m = 0; m < k; m++) {
				s += r.charCodeAt(m) * o(256, m)
			}
		}
		return s
	}

	function f(n, t, o, w) {
		var s = c.pow,
			r = c.floor,
			l = f.convertFromBinary,
			u = f.convertToBinary,
			k = n / 8,
			q = s(2, n),
			v = q / 2,
			x = v - 1,
			p = 1 / v,
			m = 1 / x;
		return w ? o ? t ? function(y, z) {
			y = r(y < 0 ? y * v + q : y * x);
			return u(y, k, z)
		} : function(y, z) {
			return u(r(y * x), k, z)
		} : t ? function(y, z) {
			return u(y < 0 ? y + q : y, k, z)
		} : function(y, z) {
			return u(y, k, z)
		} : o ? t ? function(A, z) {
			var y = l(A, z);
			return y > x ? (y - q) * p : y * m
		} : function(z, y) {
			return l(z, y) * m
		} : t ? function(A, z) {
			var y = l(A, z);
			return y > x ? y - q : y
		} : function(z, y) {
			return l(z, y)
		}
	}
	f.convertToBinary = i;
	f.convertFromBinary = a;
	f.fromQ32 = f(32, h, h, h);
	f.toQ32 = f(32, h, h, d);
	f.fromQ24 = f(24, h, h, h);
	f.toQ24 = f(24, h, h, d);
	f.fromQ16 = f(16, h, h, h);
	f.toQ16 = f(16, h, h, d);
	f.fromQ8 = f(8, h, h, h);
	f.toQ8 = f(8, h, h, d);
	f.fromInt32 = f(32, h, d, h);
	f.toInt32 = f(32, h, d, d);
	f.fromInt16 = f(16, h, d, h);
	f.toInt16 = f(16, h, d, d);
	f.fromInt8 = f(8, h, d, h);
	f.toInt8 = f(8, h, d, d);
	f.fromUint32 = f(32, d, d, h);
	f.toUint32 = f(32, d, d, d);
	f.fromUint16 = f(16, d, d, h);
	f.toUint16 = f(16, d, d, d);
	f.fromUint8 = f(8, d, d, h);
	f.toUint8 = f(8, d, d, d);
	b.Binary = f
}(this, Math));
(function(e, f) {
	function g(h) {
		this.data = h
	}
	var d = g.prototype = {
			read: function(i) {
				var h = this,
					j = h.data.substr(0, i);
				h.skip(i);
				return j
			},
			skip: function(i) {
				var h = this,
					j = h.data = h.data.substr(i);
				h.pointer += i;
				return j.length
			},
			readBuffer: function(j, n, p) {
				var k = this,
					o = "read" + p + n,
					q = n / 8,
					h = j.length,
					m = 0;
				while (k.data && m < h) {
					j[m++] = k[o]()
				}
				return m
			}
		},
		c, b;

	function a(k, i, j) {
		var h = i / 8;
		d["read" + k + i] = function(l) {
			return j(this.read(h), l)
		}
	}
	for (c in f) {
		b = /to([a-z]+)([0-9]+)/i.exec(c);
		b && a(b[1], b[2], f[c])
	}
	e.Stream = g;
	g.newType = a
}(this, this.Binary));
this.PCMData = (function(a, b) {
	function c(d) {
		return (typeof d === "string" ? c.decode : c.encode)(d)
	}
	c.decodeFrame = function(g, f, d) {
		if (f === 8) {
			var e = new(window.Uint8Array || Array)(d.length);
			(new b(g)).readBuffer(e, 8, "Uint");
			for (f = 0; f < d.length; f++) {
				d[f] = (e[f] - 127.5) * 127.5
			}
		} else {
			(new b(g)).readBuffer(d, f, "Q")
		}
		return d
	};
	c.encodeFrame = function(j, g) {
		var e = a[(g === 8 ? "fromUint" : "fromQ") + g],
			d = j.length,
			h = "",
			f;
		if (g === 8) {
			for (f = 0; f < d; f++) {
				h += e(j[f] * 127.5 + 127.5)
			}
		} else {
			for (f = 0; f < d; f++) {
				h += e(j[f])
			}
		}
		return h
	};
	c.decode = function(D, C) {
		var g = new b(D),
			n = g.read(4),
			v = g.readUint32();
		g = new b(g.read(v));
		var k = g.read(4),
			m = g.read(4),
			t = g.readUint32(),
			d = new b(g.read(t)),
			f = d.readUint16(),
			y = d.readUint16(),
			B = d.readUint32(),
			h = d.readUint32(),
			A = d.readUint16(),
			z = A / y,
			l = d.readUint16(),
			e, p, r, w, u, j, x, s = {},
			o = {
				channelCount: y,
				bytesPerSample: A / y,
				sampleRate: h / A,
				chunks: s,
				data: u
			};

		function q() {
			e = g.read(4);
			p = g.readUint32();
			w = g.read(p);
			j = s[e] = s[e] || [];
			if (e === "data") {
				r = ~~(p / z);
				u = o.data = new(typeof Float32Array !== "undefined" ? Float32Array : Array)(r);
				c.decodeFrame(w, z * 8, u)
			} else {
				j.push(w)
			}
			C && (g.data ? setTimeout(q, 1) : C(o))
		}
		if (C) {
			g.data ? q() : C(o)
		} else {
			while (g.data) {
				q()
			}
		}
		return o
	};
	c.encode = function(x, v) {
		var r = a.fromUint32,
			y = a.fromUint16,
			o = x.data,
			d = x.sampleRate,
			h = x.channelCount || 1,
			t = x.bytesPerSample || 1,
			j = t * 8,
			f = h * t,
			u = d * f,
			g = o.length,
			e = g * t,
			m = Math.pow(2, j - 1) - 1,
			l = [],
			k = "",
			w, s, p, q;
		l.push("fmt " + r(16) + y(1) + y(h) + r(d) + r(u) + y(f) + y(j));
		l.push("data" + r(e) + c.encodeFrame(o, j));
		q = x.chunks;
		if (q) {
			for (s in q) {
				if (q.hasOwnProperty(s)) {
					w = q[s];
					for (p = 0; p < w.length; p++) {
						k = w[p];
						l.push(s + r(k.length) + k)
					}
				}
			}
		}
		l = l.join("");
		l = "RIFF" + r(l.length) + "WAVE" + l;
		v && setTimeout(function() {
			v(l)
		}, 1);
		return l
	};
	return c
}(this.Binary, this.Stream));